#define _GNU_SOURCE
#include "app_pool.h"
#include "log/log.h"
#include <unistd.h>
#include <stdlib.h>

// 任务函数在线程池中的某个分线程执行中
int app_task_fun(void *arg) {
    log_debug("task fun (%d) 执行， arg=%s", gettid(), (char *)arg);

    return 0;
}

int main(int argc, char const *argv[])
{
    app_pool_init(4);

    for (int i = 0; i < 10; i++)
    {
        char *data = malloc(10);
        sprintf(data, "atguigu_%d", i);

        app_pool_registerTask(app_task_fun, data);
    }

    sleep(1);
    
    app_pool_close();
    
    return 0;
}
